﻿namespace WXWorkSvc.Common.Models;

public enum EButtonType
{
    Primary,
    Secondary,
    Warning
}
internal class TagHelperExtend
{

    #region 多字段列表 对weui Media进行了部分改造
    public const string WeuiMediaLinkDivMainClass = "weui-panel";
    public const string WeuiMediaLinkDivSecondaryClass = "weui-panel__bd weui-cells";
    public const string WeuiMediaLinkDivSecondarySytle = "margin:0";
    /// <summary>
    /// 0:Title 1:li li li
    /// </summary>
    public const string WeuiMediaLinkTextFormat = """
        <div class="weui-cell__bd">
            <div class="weui-media-box weui-media-box_text" style="padding:0">
                <h4 class="weui-media-box__title">{0}</h4>
                <ul style="margin-top:5px" class="weui-media-box__info">
                    {1}
                </ul>
            </div>
        </div>
        <div class="weui-cell__ft">
        </div>
        """;
    /// <summary>
    /// <li>{0}<li>
    /// </summary>
    public const string WeuiMediaLinkInfoFormat = """
                    <li class="weui-media-box__info__meta">{0}</li>
                    """;
    /// <summary>
    /// <li>{0}<li>
    /// </summary>
    public const string WeuiMediaLinkExtraFormat = """
        <li class="weui-media-box__info__meta weui-media-box__info__meta_extra">{0}</li>
        """;
    #endregion




    public const string WeuiCellSelectDivClass = "weui-cell weui-cell_select weui-cell_select-after";
    public const string WeuiCellSelectFormat = """
            <div class="weui-cell weui-cell_select weui-cell_select-after">
                <div class="weui-cell__hd">
                    <label for="" class="weui-label">{0}</label>
                </div>
                <div class="weui-cell__bd">
                    {1}
                </div>
            </div>

            """;


    public const string WeuiCellLinkClass = "weui-cell weui-cell_access";
    /// <summary>
    /// Parent: <div class="weui-cells"></div>
    /// </summary>
    public const string WeuiCellLinkText = """"
                            <div class="weui-cell__bd">
                                <p>{0}</p>
                            </div>
                            <div class="weui-cell__ft">
                            </div>

                            """";
    #region LinkButtonClass
    /// <summary>
    /// 
    /// </summary>
    /// <param name="buttonType"></param>
    /// <param name="isWx"></param>
    /// <param name="needMarginLeft">desk secondary button是否需要左边距</param>
    /// <returns></returns>
    public static string GetButtonCssClass(EButtonType buttonType, bool isWx = true, bool needMarginLeft = false)
    {
        if (isWx)
        {
            switch (buttonType)
            {
                case EButtonType.Primary:
                    return "weui-form-preview__btn weui-form-preview__btn_primary";
                case EButtonType.Warning:
                    return "weui-form-preview__btn weui-form-preview__btn_warning";
                case EButtonType.Secondary:
                default:
                    return "weui-form-preview__btn weui-form-preview__btn_default";
            }
        }
        else
        {
            switch (buttonType)
            {
                case EButtonType.Primary:
                    return "btn btn-primary";
                case EButtonType.Warning:
                    return "btn btn-danger";
                case EButtonType.Secondary:
                default:
                    return needMarginLeft ? "btn btn-secondary mx-1" : "btn btn-secondary";
            }
        }
    }
    #endregion
}
